<template>
	<view class="container">
		<!-- 用户信息卡片 -->
		<view class="user-card">
			<view class="user-info">
				<image class="avatar" :src="userInfo.avatar || '/static/logo.png'" mode="aspectFill"></image>
				<view class="user-detail">
					<view class="user-name-row">
						<text class="user-name">{{userInfo.nickname || '未登录'}}</text>
						<view class="vip-tag" v-if="userInfo.isVip">
							<text class="iconfont icon-vip"></text>
							<text>VIP会员</text>
						</view>
					</view>
					<text class="user-id" v-if="userInfo.userId">ID: {{userInfo.userId}}</text>
					<text class="login-btn" v-else @click="login">点击登录</text>
				</view>
			</view>
			<view class="user-stats">
				<view class="stat-item">
					<text class="stat-num">{{userInfo.studyDays || 0}}</text>
					<text class="stat-label">学习天数</text>
				</view>
				<view class="stat-item">
					<text class="stat-num">{{userInfo.questionCount || 0}}</text>
					<text class="stat-label">做题数量</text>
				</view>
				<view class="stat-item">
					<text class="stat-num">{{userInfo.correctRate || '0%'}}</text>
					<text class="stat-label">正确率</text>
				</view>
			</view>
		</view>
		
		<!-- 功能菜单 -->
		<view class="menu-section">
			<view class="menu-title">学习中心</view>
			<view class="menu-list">
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/detail/detail?type=wrong')">
					<view class="menu-icon wrong-icon">
						<text class="iconfont icon-wrong"></text>
					</view>
					<text class="menu-label">我的错题</text>
					<text class="menu-count" v-if="wrongCount > 0">{{wrongCount}}</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/detail/detail?type=favorite')">
					<view class="menu-icon favorite-icon">
						<text class="iconfont icon-star"></text>
					</view>
					<text class="menu-label">我的收藏</text>
					<text class="menu-count" v-if="favoriteCount > 0">{{favoriteCount}}</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/detail/detail?type=history')">
					<view class="menu-icon history-icon">
						<text class="iconfont icon-history"></text>
					</view>
					<text class="menu-label">做题记录</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/detail/detail?type=notes')">
					<view class="menu-icon notes-icon">
						<text class="iconfont icon-note"></text>
					</view>
					<text class="menu-label">我的笔记</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/detail/detail?type=custom')">
					<view class="menu-icon custom-icon">
						<text class="iconfont icon-folder"></text>
					</view>
					<text class="menu-label">自定义题库</text>
					<text class="iconfont icon-right"></text>
				</view>
			</view>
		</view>
		
		<view class="menu-section">
			<view class="menu-title">会员服务</view>
			<view class="menu-list">
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/vip/vip')">
					<view class="menu-icon vip-icon">
						<text class="iconfont icon-vip"></text>
					</view>
					<text class="menu-label">会员中心</text>
					<text class="menu-tag" v-if="!userInfo.isVip">立享7折优惠</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/vip/privilege')">
					<view class="menu-icon privilege-icon">
						<text class="iconfont icon-gift"></text>
					</view>
					<text class="menu-label">会员特权</text>
					<text class="iconfont icon-right"></text>
				</view>
			</view>
		</view>
		
		<view class="menu-section">
			<view class="menu-title">其他服务</view>
			<view class="menu-list">
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/feedback/feedback')">
					<view class="menu-icon feedback-icon">
						<text class="iconfont icon-feedback"></text>
					</view>
					<text class="menu-label">意见反馈</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/setting/setting')">
					<view class="menu-icon setting-icon">
						<text class="iconfont icon-setting"></text>
					</view>
					<text class="menu-label">设置</text>
					<text class="iconfont icon-right"></text>
				</view>
				<view class="menu-item" @click="navigateTo('/pages/shanganbao/about/about')">
					<view class="menu-icon about-icon">
						<text class="iconfont icon-info"></text>
					</view>
					<text class="menu-label">关于我们</text>
					<text class="iconfont icon-right"></text>
				</view>
			</view>
		</view>
		
		<!-- 版本信息 -->
		<view class="version-info">
			<text>上岸宝 v1.0.0</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {
					nickname: '张三',
					avatar: '/static/logo.png',
					userId: '10086',
					isVip: true,
					studyDays: 28,
					questionCount: 1024,
					correctRate: '85%'
				},
				wrongCount: 36,
				favoriteCount: 18
			}
		},
		onLoad() {
			// 页面加载时的逻辑
		},
		methods: {
			navigateTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			login() {
				// 模拟登录
				uni.showToast({
					title: '登录功能开发中',
					icon: 'none'
				});
			}
		}
	}
</script>

<style>
	.container {
		background-color: #f5f5f5;
		min-height: 100vh;
		padding-bottom: 30px;
	}
	
	/* 用户信息卡片 */
	.user-card {
		background-color: #1296db;
		padding: 20px 15px;
		color: #FFFFFF;
	}
	
	.user-info {
		display: flex;
		align-items: center;
		margin-bottom: 20px;
	}
	
	.avatar {
		width: 70px;
		height: 70px;
		border-radius: 35px;
		border: 2px solid rgba(255, 255, 255, 0.5);
		margin-right: 15px;
	}
	
	.user-detail {
		flex: 1;
	}
	
	.user-name-row {
		display: flex;
		align-items: center;
		margin-bottom: 5px;
	}
	
	.user-name {
		font-size: 18px;
		font-weight: bold;
		margin-right: 10px;
	}
	
	.vip-tag {
		display: flex;
		align-items: center;
		background-color: rgba(255, 215, 0, 0.2);
		border: 1px solid #FFD700;
		border-radius: 12px;
		padding: 2px 8px;
	}
	
	.vip-tag .iconfont {
		font-size: 14px;
		color: #FFD700;
		margin-right: 3px;
	}
	
	.vip-tag text {
		font-size: 12px;
		color: #FFD700;
	}
	
	.user-id {
		font-size: 14px;
		color: rgba(255, 255, 255, 0.8);
	}
	
	.login-btn {
		font-size: 14px;
		color: #FFFFFF;
		background-color: rgba(255, 255, 255, 0.2);
		padding: 5px 15px;
		border-radius: 15px;
		display: inline-block;
		margin-top: 5px;
	}
	
	.user-stats {
		display: flex;
		background-color: rgba(255, 255, 255, 0.1);
		border-radius: 10px;
		padding: 15px 0;
	}
	
	.stat-item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		position: relative;
	}
	
	.stat-item:not(:last-child)::after {
		content: '';
		position: absolute;
		right: 0;
		top: 10%;
		height: 80%;
		width: 1px;
		background-color: rgba(255, 255, 255, 0.2);
	}
	
	.stat-num {
		font-size: 18px;
		font-weight: bold;
		margin-bottom: 5px;
	}
	
	.stat-label {
		font-size: 12px;
		color: rgba(255, 255, 255, 0.8);
	}
	
	/* 功能菜单 */
	.menu-section {
		background-color: #FFFFFF;
		margin: 10px 15px;
		border-radius: 10px;
		padding: 15px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
	}
	
	.menu-title {
		font-size: 16px;
		font-weight: bold;
		color: #333;
		margin-bottom: 15px;
	}
	
	.menu-list {
		
	}
	
	.menu-item {
		display: flex;
		align-items: center;
		padding: 12px 0;
		border-bottom: 1px solid #f5f5f5;
	}
	
	.menu-item:last-child {
		border-bottom: none;
		padding-bottom: 0;
	}
	
	.menu-icon {
		width: 36px;
		height: 36px;
		border-radius: 18px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-right: 10px;
	}
	
	.menu-icon .iconfont {
		font-size: 18px;
		color: #FFFFFF;
	}
	
	.wrong-icon {
		background-color: #f5222d;
	}
	
	.favorite-icon {
		background-color: #faad14;
	}
	
	.history-icon {
		background-color: #722ed1;
	}
	
	.notes-icon {
		background-color: #13c2c2;
	}
	
	.custom-icon {
		background-color: #52c41a;
	}
	
	.vip-icon {
		background-color: #FFD700;
	}
	
	.privilege-icon {
		background-color: #eb2f96;
	}
	
	.feedback-icon {
		background-color: #1890ff;
	}
	
	.setting-icon {
		background-color: #8c8c8c;
	}
	
	.about-icon {
		background-color: #1296db;
	}
	
	.menu-label {
		flex: 1;
		font-size: 14px;
		color: #333;
	}
	
	.menu-count {
		font-size: 12px;
		color: #FFFFFF;
		background-color: #f5222d;
		border-radius: 10px;
		padding: 2px 8px;
		margin-right: 10px;
	}
	
	.menu-tag {
		font-size: 12px;
		color: #f5222d;
		margin-right: 10px;
	}
	
	.menu-item .icon-right {
		font-size: 14px;
		color: #ccc;
	}
	
	/* 版本信息 */
	.version-info {
		text-align: center;
		padding: 20px 0;
	}
	
	.version-info text {
		font-size: 12px;
		color: #999;
	}
</style>